#pragma once
#include "ui_QChatSrvDlg.h"


QT_BEGIN_NAMESPACE
namespace Ui { class QChatSrvDlg; };
QT_END_NAMESPACE


class QChatSrvDlg : public QDialog
{
    Q_OBJECT

public:
    QChatSrvDlg(QWidget *parent = nullptr);
    ~QChatSrvDlg();

public slots:
    void OnStartSrv();
    void OnStopSrv();

    void OnGetNewConnection();
    void CloseConnect();

    void OnQueryUserName(QTcpSocket* pSock, QString const& userName);
    void OnUserLogin(QTcpSocket* pSock, QString const& userName);

    void OnGetUserInfoList(QTcpSocket* pSock, QString const& userName, QString const& token);

    void OnSendUserMessage(QTcpSocket* pSock, QString const& userName, QString const& token, QString const& msg);

protected:
    void InitSlotFun();

private:
    Ui::QChatSrvDlg*ui;

    QTcpServer* m_pTcpServer = nullptr;
};
